package homeWork;

public class Musician {
    void play(Instrument itn){
        itn.makeSound();
    }
    public static void main(String[] args) {
        Musician person = new Musician();
        person.play(new Erhu());
    }
}

abstract class Instrument{
    abstract void makeSound();
}
class Erhu extends Instrument{

    @Override
    void makeSound() {
        System.out.println("弹奏了二胡！");
    }
}
class Piano extends Instrument{

    @Override
    void makeSound() {
        System.out.println("弹奏了钢琴！");
    }
}
class Violin extends Instrument{

    @Override
    void makeSound() {
        System.out.println("弹奏了小提琴！");
    }
}
